﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>VEToolkit.Math.CalculateMidPoint Sample</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
      
      <script type="text/javascript" src="../../scripts/VEToolkit.Core.js"></script>
      
      <script type="text/javascript">
          var map = null;
          
          function GetMap() {
              map = new VEMap('myMap');
              map.LoadMap();

              /// Plot Polyline
              var points = [
                    new VELatLong(43.64508171979899, -79.3930435180664),
                    new VELatLong(43.64486433588385, -79.3791389465332)
                ];

              var polyline = new VEShape(VEShapeType.Polyline, points);
              polyline.HideIcon();
              map.AddShape(polyline);
              map.SetMapView(points);

              // Calculate and plot the mid point (center point)
              var midPoint = new VEShape(VEShapeType.Pushpin, VEToolkit.Math.CalculateMidPoint(points[0], points[1]));
              midPoint.SetTitle("Polyline Mid Point (Center Point)");
              map.AddShape(midPoint);
          }
      </script>
   </head>
   <body onload="GetMap();">
    <h1>VEToolkit.Math.CalculateMidPoint</h1>
    <div id='myMap' style="position:relative; width:400px; height:400px;"></div>

   </body>
</html>

